var express = require('express');
var http = require('http');
var router = express.Router();

/* GET users listing. */
var options = {
    host: '127.0.0.1',
    port: 8080,
    path: '/users/1',
    method: 'GET',
};

router.get('/', function (req, response) {
    var req = http.request(options, function (res) {
        res.setEncoding('utf8');
        res.on('data', function (data) {
            response.contentType('application/json');
            response.send(data);
            var data = JSON.parse(data);
        });
    });
    req.end();
});

router.post('/', function (req, res) {
    res.contentType('application/json');
    res.send('respond with a resource' + JSON.stringify(req.body));
});

module.exports = router;
